<?php

/*
 * This file is create for storing name of table, and field.
 * 
 */

if (!function_exists('delete_file')) {

    function delete_file($file) {		
        if (@unlink($file)) {
            return TRUE;
        }
		
        return FALSE;
    }
}

if (!function_exists('resize_image')) {

    function resize_image($image, $new_height, $new_width, $path, $new_path = '', $thumb_marker = '', $ratio = true){
        $ci = &get_instance();
		
        list($width, $height) = getimagesize($path . $image);
		$new_path = empty($new_path) ? $path . 'thumbs/' : $new_path;
		$new_width = empty($new_width) ? (($width * $new_height) / $height) : $new_width;
		
		$config = array(
					   'source_image'   => $path . $image,
					   'new_image'      => $new_path . $image,
					   'create_thumb'   => true,
					   'thumb_marker'	=> $thumb_marker,
					   'maintain_ratio' => $ratio,
					   'height'         => $new_height,
            		   'width'			=> $new_width
					   );
		
		$ci->load->library('image_lib', $config);
		$ci->image_lib->resize();
    }
}